package cn.larry.aop.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.larry.aop.domain.User;
import cn.larry.aop.service.UserService;

/**
 * @author LarryZeal
 *
 */
@Profile("execution")
@RestController
@RequestMapping("/exec")
public class ExecutionController {
	Logger				logger	= LoggerFactory.getLogger(ExecutionController.class);

	@Autowired
	private UserService	userService;

	@GetMapping("/hi")
	public User findById() {
		logger.info("hi");
		return userService.findById(1);
	}

	@GetMapping("/hey")
	public User findByName() {
		logger.info("hey");
		return userService.findByName("Larry");
	}

}
